﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>String - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The String function converts a value to a string." />
<meta name="ahk:equiv-v1" content="AutoHotkey.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>String</h1>
<p>将值转换为字符串.</p>
<pre class="Syntax">StrValue := <span class="func">String</span>(Value)</pre>

<h2 id="Return_Value">返回值</h2>
<p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
<p>函数返回将值 <em>Value</em> 转换为字符串的结果, 如果是字符串, 则返回 <em>Value</em> 本身.</p>
<p>如果 <em>Value</em> 是数字, 则使用<a href="../Concepts.htm#number-default-format">默认的十进制格式</a>.</p>
<p>如果 <em>Value</em> 是对象, 则返回值是调用 <code>Value.ToString()</code> 的结果. 如果对象没有这样的方法, 则抛出异常. 默认情况下该方法没有实现, 因此必须由脚本定义.</p>

<h2 id="Related">相关</h2>
<p><a href="Type.htm">Type</a>, <a href="Integer.htm">Integer</a>, <a href="Float.htm">Float</a>, <a href="../Concepts.htm#values">Values</a>, <a href="../Language.htm#expressions">Expressions</a>, <a href="Is.htm">Is functions</a></p>

</body>
</html>